import { ref } from "vue"
export function useNumber(){
  const category = [
    { type: 1, label: '0-10' },
    { type: 2, label: '11-20' },
    { type: 3, label: '21-40' },
    { type: 4, label: '41-60' },
    { type: 5, label: '61-80' },
    { type: 6, label: '81-100' },
  ]
  const current = ref(0)
  const numberList = ref([])
  // 获取数字列表
  const useGetNumberList = (start, end) => {
	  const item = category[current.value].label.split('-')
    const numberItem = []
	numberList.value = []
    for(let i = Number(item[0]); i < (Number(item[1])+1); i++) {
      numberItem.push({label: i})
    }
    numberList.value = numberItem
  }
  const useChangeNumber = (index) => {
	  current.value = index
	  useGetNumberList()
  }
  return {
    useGetNumberList,
	useChangeNumber,
    numberList,
    current,
	category
  }

}